<!doctype html>
<html>
<head>
	<!-- json2 is included because some browsers doesnt have it (e.g. ie8)	-->
	<script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
	
	<script src="../node/server/node_modules/socket.io-client/dist/socket.io.js"></script>
	<script src="../node/easyWebSocket-node.js"></script>
<!--	<script src="../easyWebSocket-node.min.js"></script>
-->	
</head>
<body>
	<script>
		var basicTest	= function(){
			// setup EasyWebSocket for local server + loggin
			EasyWebSocket.serverUrl		= "http://192.168.0.10:8950";
			//EasyWebSocket.logFunction	= function(){ console.log.apply(console, arguments) }

			var url		= "ws://example.com/superwa/wa"
			var socket 	= new EasyWebSocket(url);
			var bootTime	= new Date();
			var sendTime	= null;
			socket.onopen	= function(){
				console.log("connected in", new Date() - bootTime,"ms");
				sendTime	= new Date();
				socket.send("hello world")
			}
			socket.onmessage= function(event){
				console.log("socket onmessage event", event.data, new Date() - sendTime, "ms")
				alert("OK")
			}
			socket.onclose	= function(){
				console.log("socket onclose")			
			}
		}
		basicTest();
	</script>
</body>
</html>
